package com.ky.facescan.api.interceptor;



import com.ky.facescan.constants.Constants;
import com.ky.facescan.utils.SPUtils;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;


public class HeaderInterceptor implements Interceptor {

    public HeaderInterceptor() {
    }

    @Override
    public Response intercept(Chain chain) throws IOException {
        String token = SPUtils.getInstance().getString(Constants.SpKey.TOKEN);
        Request request = chain.request().newBuilder()
                .addHeader("Content-Type", "application/json; charset=utf-8")
                .addHeader("gray-version", Constants.GRAY_VERSION)
                .addHeader("token", token)
                .build();
        return chain.proceed(request);
    }
}
